<?php
session_start();
include_once("../../untils/conn.php");
mysqli_query($con, "set names utf8");

// 获取当前正在登录的账号信息的代理
$proxy_acc = $_SESSION["account"];

// 查询代理的所有信息字段
$sql = "SELECT * FROM `proxy` WHERE `proxy_acc`='$proxy_acc'";
$result = mysqli_query($con, $sql);

// 构建 JSON 数据并输出给前端
$data = array();
if(mysqli_num_rows($result) > 0) {
    while($row = mysqli_fetch_assoc($result)) {
        $proxy_acc = $row['proxy_acc'];
        $proxy_phone = $row['proxy_phone'];
        
        $proxy_name = $row['proxy_name'];
        $proxy_img =  $row['proxy_img'];
        $proxy_rename = $row['proxy_rename'];
        $proxy_uid   = $row['proxy_uid'];
        $proxy_alipay =$row ['proxy_alipay'];
        $proxy_alipay_acc = $row ['proxy_alipay_acc'];
        $proxy_yihname = $row ['proxy_yihname'];
        $proxy_yihnum = $row['proxy_yhnum'];
        $proxy_bank_name = $row['proxy_bank_name'];
        $proxy_bank_zh = $row['proxy_bank_zh'];
        $proxy_rename_sta = $row['proxy_rename_sta'];
        $proxy_sta = $row['proxy_sta'];
        $proxy_type = $row['proxy_type'];
        // $proxy_intcode = $row['proxy_intcode'];
        // 将代理名和代理头像添加到数据数组中
        $data["name"] = $proxy_name;
        $data["avatar"] = $proxy_img;
        $data["account"] = $proxy_acc;
        $data["phone"] = $proxy_phone;
        $data["rename"] = $proxy_rename;
        $data["card_uid"] = $proxy_uid;
        $data["alipay"] = $proxy_alipay;
        $data["alipay_acc"] = $proxy_alipay_acc;
        $data["bank_name"] = $proxy_yihname;
        $data["bank_acc"] = $proxy_yihnum;
        $data["proxy_bank_name"] = $proxy_bank_name;
        $data["proxy_bank_zh"] = $proxy_bank_zh;
        $data["rename_sta"] = $proxy_rename_sta;
        $data["stauts"] = $proxy_sta;
        $data["puid"] = $proxy_puid;
         $data["type"] = $proxy_type;
    }
}
// 将数据数组转换为 JSON 格式并输出
echo json_encode($data);
?>
